import Vue from 'vue'
import Router from 'vue-router'

import Login from '../views/Login'
import Main from '../views/Main';

// 用于嵌套的路由组件
import UserProfile from '../views/user/Profile'
import UserList from '../views/user/List'

import NotFound from '../views/NotFound'

Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/login',
            name: 'Login',
            component: Login
        },
        {
            path: '/main',
            name: 'Main',
            component: Main,
            children: [
                {
                    path: '/user/profile/:id',
                    name: 'UserProfile',
                    component: UserProfile,
                    props: true
                },
                {
                    path: '/user/list',
                    name: 'UserList',
                    component: UserList
                },
            ]
        },
        {
            path: '/gohome',
            redirect: '/main'
        }
    ]

})